#!/usr/bin/env python
# -*- coding:utf-8 -*-
import threading
import time

lock=threading.Lock()       #加锁防争抢屏幕输出
def run(num):
    lock.acquire()
    print "thread......" ,num
    lock.release()
    time.sleep(1)

for i in range(10):
    t = threading.Thread(target=run,args=(i,))  #实例化，i后面必须有逗号，每创建一个线程，执行run函数。
    t.start()   #执行start方法